package com.gticket.cinemauser.mapper;

import com.gticket.cinemauser.pojo.Role;
import com.gticket.cinemauser.pojo.Users;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RoleMapper {

    /**
     * 通过用户名和对应影院名查询用户角色
     * @param user users对象，需传入用户名、影院名
     * @return Role 用户角色信息
     */
    @Select("select r.role_id,r.role_name,r.flag " +
            "from ${databaseName}.roles r " +
                "left outer join ${databaseName}.users u on r.role_id=u.role_id " +
            "where u.user_name=#{user_name} and r.flag = 0")
    Role selectRolesByUser_name(Users user);
}
